package com.lj.api.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class TryCatchAspect {
    @Around("execution(* com.lj.api.aspect.tools.*.*(..))") // 设置切点表达式，此处为com.example包及子包下所有类的任意方法
    public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
        try {
            System.out.println("apo start =======");
            return joinPoint.proceed(); // 调用原始方法
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("error aspject "+e.getMessage());
            return null;
        }
    }
}
